<?php
$id_list = uniqid();
?>
<div class="navi">
	<div class="left">
		<div class="btn-group">
			<?php
			echo UI\Tag::btn('Add new', array('href' => Uri::create('admin/qualification/add')));
			echo UI\Tag::btn('<span class="ico-equalizer"></span>', array(), true);
			?>
		</div>
	</div>
	<div class="right">
		<div id="<?php echo $id_list.'_title' ?>" class="page-title">
			Qualifications Management
		</div>
		<div class="btn-actions" id="<?php echo $id_list.'_actions' ?>">
			<?php
			echo UI\Tag::btn('<span class="ico-trashcan"></span>', array('onclick' => 'App.doActionDelete(\'' . Uri::create('admin/qualification/delete') . '\', \'' . $id_list . '\')'));
			?>
		</div>
		<div class="btn-group">
			<?php echo UI\Admin\Tag::search_form(); ?>
		</div>
	</div>
</div>

<?php
$table = UI\Admin\Table::forge($id_list);
$table->add_header(Form::checkbox(array(
	'class' => 'checkall',
	'name' => ''
)));
$table->add_header('Title');
$table->add_header('Type');
$table->add_header('Actions', array('width' => '8%'));
$table->add_page($zlist->pagination->render());

foreach ($zlist->posts as $qualification) {
	$table->add_col(Form::checkbox(array(
		'name' => 'ID[]',
		'class' => 'check-item',
		'value' => $qualification->id
	)));
	$table->add_col(Html::anchor('admin/qualification/edit/' . $qualification->id, $qualification->name));
	$table->add_col(Html::anchor('admin/qualification?type_id='.$qualification->type_id, $qualification->type_name));
	$table->add_col(Html::anchor('admin/qualification/edit/' . $qualification->id, 'Edit') . ' | ' . '<a href="javascript:;" onclick="App.delete(\'' . Uri::create('admin/qualification/delete') . '\', {id: ' . $qualification->id . '});">Del</a>');
	$table->next();
}

echo $table->html();
?>